package com.eqdd.yiqidian.ui.gongneng.renshi.meeting

import android.support.v7.widget.RecyclerView
import android.view.View
import com.eqdd.yiqidian.R
import com.eqdd.yiqidian.base.Config
import com.eqdd.yiqidian.bean.MeetingRecordBean
import com.eqdd.yiqidian.bean.rebuild.slimedit.SlimEditHintBean
import com.eqdd.yiqidian.ui.base.SlimBaseMultiEditActivity
import kotlinx.android.synthetic.main.activity_recyclerview.*
import org.jetbrains.anko.toast

/**
 * Created by jhj on 18-6-9.
 */
class MeetingRecordInfoActivity : SlimBaseMultiEditActivity() {

    var recordBean: MeetingRecordBean? = null


    override fun initBinding() {
        clearData()
        setContentView(R.layout.activity_recyclerview)
        initTopTitleBar(View.VISIBLE, "会议记录")
        recordBean = intent.getSerializableExtra("data") as MeetingRecordBean?
        if (recordBean == null) {
            toast("获取会议详情失败")
            finish()
            return
        }

    }

    override fun initRecyclerView(): RecyclerView {
        return recyclerView
    }

    override fun itemClick(p: Int) {

    }

    override fun setEditBeans() {
        recordBean?.let {
            val assist = StringBuilder()
            val notify = StringBuilder()
            it.newAssist.forEach { s ->
                assist.append(s.name).append(",")
            }
            it.newNotify.forEach { s ->
                notify.append(s.name).append(",")
            }

            datas.add(SlimEditHintBean("记录名称", it.taskName, 0))
            datas.add(SlimEditHintBean("父项目", it.parentTaskName, 1))
            datas.add(SlimEditHintBean("责任人", it.newRecipient.name, 2))
            if (it.newAssist != null && it.newAssist.size > 0)
                datas.add(SlimEditHintBean("协助人", assist.substring(0, assist.length - 1), 3))
            if (it.newNotify != null && it.newNotify.size > 0)
                datas.add(SlimEditHintBean("知会人", notify.substring(0, notify.length - 1), 4))
            datas.add(SlimEditHintBean("开始时间", it.startTime, 5))
            datas.add(SlimEditHintBean("结束时间", it.endTime, 6))
            datas.add(SlimEditHintBean("验收标准", it.checkStandard, 7))
            datas.add(SlimEditHintBean("验收人", it.newChecker.name, 8))
            datas.add(SlimEditHintBean("验收时间", it.checkTime, 9))
            datas.add(SlimEditHintBean("记录描述", it.taskDesc, 10))

        }
    }
}